extends head

block content
    body.dashboard.form-signin-wrapper
        div#register.container
            form.form-signin
                div.panel.periodic-register
                    span.atomic-number 01
                    div.panel-body.text-center
                        h1.atomic-symbol 果
                        p.atomic-mass 01.161001
                        p.element-name 果然之味
                        i.icons.icon-arrow-down
                        div.form-group.form-animate-text(style="margin-top:40px !important;")
                            input.form-text(v-model='company',type='text',required)
                            span.bar
                            label 企业名称
                        div.form-group.form-animate-text(style="margin-top:40px !important;")
                            input.form-text(v-model='username',type='text',required)
                            span.bar
                            label 用户名
                        div.form-group.form-animate-text(style="margin-top:40px !important;")
                            input.form-text(v-model='passwd',type='Password',required)
                            span.bar
                            label 密码
                        input.btn.col-md-12(type="button",value="注册",@click="register")
                    div.text-center(style="padding:5px;")
                        a(href="/manager/user/login") 已有账户？
block append footer
    script(type='text/javascript').
        $(document).ready(function () {
            var regForm = new Vue({
                el:'#register',
                data:{
                    company:'',
                    username:'',
                    passwd:''
                },
                methods:{
                    init:function () {

                    },
                    register:function (){

                        if(regForm.company == ''){
                            zxlib.showAlert("warning","请填写公司名称");
                            return;
                        }

                        if(regForm.username == ''){
                            zxlib.showAlert("warning", "请填写用户名");
                            return;
                        }

                        if(regForm.username.indexOf('@') <= 0){
                            zxlib.showAlert("warning", "请填写邮箱");
                            return;
                        }

                        if(regForm.passwd == ''){
                            zxlib.showAlert("warning", "请填写密码");
                            return;
                        }

                        zxlib.fpost('/manager/user/registerUser',{company:regForm.company,username:regForm.username,passwd:regForm.passwd}, function (data) {
                            if(data.code == 0) {
                                zxlib.showAlert("success", data.msg, 1000, function () {
                                    location.href = data.url;
                                });
                            }else {
                                zxlib.showAlert("warning ",data.msg);
                            }
                        },function (data) {
                            zxlib.showAlert("error ",data.msg);
                        })
                    }
                }
            });
        });